var userId,roleId,userName1,changePwd;
// 王欢
// var testUrlPath = '192.168.22.27';//开发环境
// 龚汉卿
// var testUrlPath = '192.168.22.12';//开发环境
//  var testUrlPath = '122.96.153.122';//涵碧楼的206地址
 var testUrlPort = '50001';
//var testUrlPath ='192.168.0.204';// 涵碧楼测试环境
var testUrlPath ='192.168.0.206';// 新港测试环境
//var testUrlPath ='192.168.0.166';
//var testUrlPath = '58.240.18.62';//开发环境，内网后台
var testUrlDownInvoicePort = '9015';
var testUrl = 'http://'+testUrlPath+':'+testUrlPort;
var testUrlDownInvoiceUrl = 'http://'+testUrlPath+':'+testUrlDownInvoicePort;
//返回
function backBtnHander() {
    urlList = getUrlList();
    var a = urlList.pop();
    setUrlList(urlList);
    let isFirst = sessionStorage.getItem("IsFirst");
    if(isFirst==1){
        sessionStorage.setItem("SessionList",JSON.stringify([]))
    }
    sessionStorage.setItem("hasBack",1)
    sessionStorage.setItem("isBack", 1)
    $("#if").load(a)
}


/**
 * 生成header
 * @returns
 */
function generateHeader() {
    var header = '{"userId":"'+userId+'","roleId":"'+roleId+'","postId":"'+roleId+'","organizationName":"'+444+'","organizationId":"'+333+'", "userName":"'+userName1+'","deviceId": "", "deviceType": "","devModuleID": "","accessToken":"","appVersion": "","osVersion": "","appIdentifier": "","workBench": "" }';
    return header;
}


function loadModalShow(){
    suitSize($(".loadModal>div"));
    $(".loadModal").css({'opacity':'0.9','visibility':'visible'});
}

function loadModalHide(){
    $(".loadModal").css({'opacity':'0','visibility':'hidden'});
}
$(document).ajaxStart(function(){
    loadModalShow();
})
//
$(document).ajaxStop(function(){
    loadModalHide();
});

/**String 转数组**/
function stringToArray(str) {
    var tempArr = str.split(',');
    return tempArr;
}
/**数组 转String **/
function arrayToString(arr) {
    var tmpStr = arr.join(",");
    return tmpStr;
}
/**从缓存获取 urlList*/
function getUrlList() {
    var urlListStr = localStorage.getItem("urlList");
    if (!urlListStr) {
        urlListStr = "10";
        localStorage.setItem("urlList", urlListStr);
    }
    urlList = stringToArray(urlListStr);
    return urlList;
}
/**存放urlList进缓存*/
function setUrlList(urlList) {
    var urlListStr = arrayToString(urlList);
    localStorage.setItem("urlList", urlListStr);
}

// 日期插件
$(document).on("focus", '.dateInput', function () {
    laydate.render({
        elem: this
        //		    ,trigger: 'focus'
        , min: '1990-1-1'
    });
});
// 每页的菜单路径
function showCurrentURL() {
    let state = getSessionStorage('state');
    let folderName = getSessionStorage('folderName');
    if (state == '00') {
        $('.mainText .from').find('li').eq(0).text('任务');
        $('.mainText .from').find('li').eq(1).text(folderName);
    } else if (state == '0') {
        $('.mainText .from').find('li').eq(0).text('拟办');
        $('.mainText .from').find('li').eq(1).text(folderName);
    } else if (state == '1') {
        $('.mainText .from').find('li').eq(0).text('待 办');
        $('.mainText .from').find('li').eq(1).text(folderName);
    } else if (state == '2') {
        $('.mainText .from').find('li').eq(0).text('办 结');
        $('.mainText .from').find('li').eq(1).text(folderName);
    }
    // 右侧功能菜单 点击新增
    $(".mainText").on("click", ".titleButton .add", function (e) {
        // console.log($(this).attr("data-folderName"))
    })

    // 表格中点击 跳转详情 和 点击修改
    $(".mainText").on("click", ".defaltTable .detail,.defaltTable .edit", function (e) {
        // console.log($(this).attr("data-folderName"))
    })
    // 跳转至二级菜单页
    $('.mainText .from').on('click', 'li', function () {
        if (state != '00') {
            $('#if').load('/workbench/menu_1.html');
        } else {
            $('#if').load('/projectMgt/taskMgt/taskCreateNBList.html');
        }
    })
}
$(document).on("focus", '.nomDateInput', function () {
    laydate.render({
        elem: this
    });
});

/**
 /** 模拟alert,confirm
 * type  alert 或者confirm 必填
 * title 标题 必填
 * mes 提示语句  ''
 * */
alertNo()
function alertNo() {
    $.MsgBox = {
        alert: function (title, mes, callback_ok) {
            tipBox('alert', title, mes);
            $('.tipBox').find("li").click(function () {
                $(".tipBox").remove();
                $(".tipModal").remove();
                if ($(this).is('.tip_true')) {
                    if (typeof (callback_ok) == 'function') {
                        callback_ok();
                    }
                }
            })

            /*setTimeout(function(){$('.tipBox').find(".tip_true").click()},3000);*/
            $('.tip_true').addClass('clickFontWeight');
        },
        confirm: function (title, mes, callback_ok, callback_no) {
            tipBox('confirm', title, mes);
            $('.tipBox').find('li').click(function () {
                $(".tipBox").remove();
                $(".tipModal").remove();
                if ($(this).is('.tip_false')) {
                    if (typeof (callback_no) == 'function') {
                        callback_no()
                    }

                } else if ($(this).is('.tip_true')) {
                    if (typeof (callback_ok) == 'function') {
                        callback_ok();
                    }
                };


            })
            $('.tip_true').addClass('clickFontWeight');
        }
    };
}
function tipBox(type, title, mes) {
    var tipContent = `
		<div class="tipModal"></div>
		<div class="tipBox">
			<div class="tipHeader">
				${title}
			</div>
			<div class="tipBody">
				<img src="/assets/img/tips1.png">
				<p class="msg">${mes}</p>
			</div>
	 `;
    if (type == 'alert') {
        tipContent += `<div class="tipfooter">
	 					<div class="footer">
	 						<ul class="functionButton titleButton">
	 							<li class="tip_true">
				                    <p class="hover">
				                        <span>确认</span>
				                    </p>
				                </li>
            				</ul>
		            	</div>
		            </div>`;
    } else if (type == 'confirm') {
        // tipContent += '<div class="tipfooter"><button class="btn tip_true">确认</button><button class="btn tip_false">取消</button></div>';
        tipContent += `<div class="tipfooter">
	 		<div class="footer">
	 		<ul class="functionButton titleButton">
                
                <li class="tip_true">
                    <p class="hover">
                        <span>确认</span>
                    </p>
                </li>
                <li class="tip_false">
                    <p class="hover">
                        <span>取消</span>
                    </p>
                </li>
            </ul>
			</div>
            </div>`;
    }
    tipContent += '</div>';
    $('body').append(tipContent);
    var winHeight = $(window).height(),
        winWidth = $(window).width(),
        popHeight = $('.tipBox').innerHeight(),
        popWidth = $('.tipBox').innerWidth(),
        popTop = (winHeight - popHeight) / 2,
        popLeft = (winWidth - popWidth) / 2;
    $('.tipBox').css({ "top": popTop, "left": popLeft });
};

hover()
function hover() {
    $(document).find('.functionButton li p').addClass('hover');
}

// 选项卡
function tab() {
    let tab = $('.tab');
    if (tab.size() == 0) return;
    tab.each((i, item) => {
        let tabBar = tab.eq(i).find('.tabBarItem'),
            tabItem = tab.eq(i).find('.tabItem'),
            tabList = tab.eq(i).find('.tableList'),
            pre = tab.eq(i).find('.preview'),
            next = tab.eq(i).find('.next'),
            tabBarSelected = tabBar.filter(".selected"),
            selectedTarBarItem = tab.eq(i).find('.tabBarItem.selected').index();
        tabItem.hide();
        tabItem.eq(tabBarSelected.index()).show();
        tabBar.on('click', function () {
            if ($(this).hasClass("disable")) return;
            $(this).addClass("selected").siblings().removeClass("selected");
            let i = $(this).index();
            tabItem.hide().eq(i).show();
            selectedTarBarItem = tab.eq(i).find('.tabBarItem.selected').index();
            if (selectedTarBarItem == 0) {
                pre.removeClass('hover').addClass('grey');
                next.addClass('hover normal').removeClass('grey');
            } else if (selectedTarBarItem == tabBar.length - 1) {
                pre.addClass('hover normal').removeClass('grey');
                next.removeClass('hover').addClass('grey');
            } else {
                pre.addClass('hover normal').removeClass('grey');
                next.addClass('hover normal').removeClass('grey');
            }
        })
        next.on('click', function () {
            selectedTarBarItem = tab.eq(i).find('.tabBarItem.selected').index();
            tabBar.eq(selectedTarBarItem).next().addClass('selected').siblings().removeClass("selected");
            tabItem.eq(selectedTarBarItem).next().show().siblings().hide();
            if (selectedTarBarItem == tabBar.length - 2) {
                next.removeClass('hover normal').addClass('grey');
                pre.addClass('hover normal').removeClass('grey');
            } else {
                next.addClass('hover normal').removeClass('grey');
                pre.addClass('hover normal').removeClass('grey');
            }
        })
        pre.on('click', function () {
            selectedTarBarItem = tab.eq(i).find('.tabBarItem.selected').index();
            tabBar.eq(selectedTarBarItem).prev().addClass('selected').siblings().removeClass("selected");
            tabItem.eq(selectedTarBarItem).prev().show().siblings().hide();
            if (selectedTarBarItem == 1) {
                pre.removeClass('hover normal').addClass('grey');
                next.addClass('hover normal').removeClass('grey');
            } else {
                pre.addClass('hover normal').removeClass('grey');
                next.addClass('hover normal').removeClass('grey');
            }
        })
        if (selectedTarBarItem == 0) {
            pre.removeClass('hover').addClass('grey');
        } else if (selectedTarBarItem == tabBar.length - 1) {
            next.removeClass('hover').addClass('grey');
        } else {
            pre.addClass('hover normal').removeClass('grey');
            next.addClass('hover normal').removeClass('grey');
        }
    })
}
// 实例化滚动条
function scroll() {
    $(document).find('.inwrap').each(function (i) {
        if ($(this).eq(i).find('.incont')) {
            $(this).find(".incont").addClass("incont"+i);
            $(this).find('.inbar').addClass("inbar"+i);
            $(this).find('.inslider').addClass("inslider"+i);
            new CusScrollBar({
                contSelector: '.incont' + i, // 可视区
                barSelector: '.inbar' + i, // 滚动条选择器
                sliderSelector: '.inslider' + i //滚动滑块儿选择器
            });
        }
    })
    $.each($(document).find('.scroll-wrap'), function(i){
        if ($(this).eq(i).find('.scroll-cont')) {
            $(this).find('.scroll-cont').addClass("cont"+i);
            $(this).find('.scroll-bar').addClass("bar"+i);
            $(this).find('.scroll-slider').addClass("slider"+i);
            new CusScrollBar({
                contSelector: '.cont' + i, // 可视区
                barSelector: '.bar' + i, // 滚动条选择器
                sliderSelector: '.slider' + i //滚动滑块儿选择器
            });
        }
    })

}

header()
function header() {
    let x = 0,
        y = 0,
        div = '',
        x1 = 0,
        x2 = 0,
        y1 = 0,
        y2 = 0;
    let time = '';
    $(".modal").scroll(function (ev) {//注意加ev
        ev.stopPropagation();
        // console.log(2323)
        // var sc = ev.wheelDelta;
    });
    $(".veil").scroll(function (ev) {//注意加ev
        ev.stopPropagation();
        // console.log(2323)
        // var sc = ev.wheelDelta;
    });
    window.onmousewheel = function (e) {
        e.stopPropagation();
        var e = window.event || e;
        var tag = e.target;
        clearTimeout(time);
        // if($(tag).parents(".modalBody")){
        //     tag.onmousewheel = function (ev) {//注意加ev
        //         ev.stopPropagation();
        //         var sc = ev.wheelDelta;
        //     }
        //     $(".veil").onmousewheel = function (ev) {//注意加ev
        //         ev.stopPropagation();
        //
        //     }
        // }
        time = setTimeout(function () {
            if (e.wheelDelta > 0 || e.detail > 0) {
                $('.nav').slideDown(200);
                $('.wapper').css({ 'margin-top': '54px', 'padding-top': '20px' });
                // 页面无标签时使用，例：供应商信用金申请
                $('.tableList').removeClass('tableListNoTab');
                // 页面有标签时使用，例：采购订单详情
                $('.tableContent').removeClass('tableListTab');
                // 任务规划
                $('.taskPlanBox').removeClass('taskPlanBoxH');
            } else {
                $('.nav').slideUp(200)
                $('.wapper').css({ 'margin-top': '0', 'padding-top': '0' });
                $('.tableList').addClass('tableListNoTab');
                $('.tableContent').addClass('tableListTab');
                $('.taskPlanBox').addClass('taskPlanBoxH');
            }
        })
    }
}

// fullScreen()
//浏览器进入全屏模式，兼容IE
function fullScreen() {
    var el = document.documentElement;
    var rfs = el.requestFullScreen || el.webkitRequestFullScreen ||
        el.mozRequestFullScreen || el.msRequestFullScreen;
    if (typeof rfs != "undefined" && rfs) {
        rfs.call(el);
    } else if (typeof window.ActiveXObject != "undefined") {
        //for IE，这里其实就是模拟了按下键盘的F11，使浏览器全屏
        var wscript = new ActiveXObject("WScript.Shell");
        if (wscript != null) {
            wscript.SendKeys("{F11}");
        }
    }
}
/*
 * 请求ftp文件上传服务
 */
function CommonRequestFtpUpload(modeName,backFunction) {
    $(document).off("change", ".uploadfile");
    $(document).on("change", ".uploadfile", function () {
        var fileval = $(this).val();
        if (fileval != 0 && fileval) {
            var textthis = $(this);
            var textthis2 = $(this).parents('.dataForm');
            var formData = new FormData(textthis2[0]);
            formData.append("modeName", modeName);
            //上传文件url
            var url = "/ftp/uploadFile";
            // console.log("请求数据=="+formData);
            if (typeof (token) == 'undefined' || token == null || token == '') {
                window.location.href = "/login.html";
            }
            var aJaxRequest = $.ajax({
                type: "POST",
                beforeSend: function (request) {
                    request.setRequestHeader("Authorization", token);
                },
                url: testUrl + url,
                async: true,
                dataType: "json",
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    // console.log("响应数据=="+JSON.stringify(data)+'url=='+url);
                    if ("0" == data.header.code) {
                        if (data.body != null) {

                            var urltextmodename = encodeURI(data.body.modeName);
                            var urltextfilename = encodeURI(data.body.fileNames[0]);
                            textthis.parents('td').attr('data-modeName', data.body.modeName);
                            textthis.parents('td').attr('data-fileName', data.body.fileNames[0]);
                            textthis.parents('td').find('.aUploada').html(`重新上传`);
                            // textthis.parents('td').find('.uploadfile').css('width','53px')
                            // textthis.parents('td').find('.aUploada').css('position','absolute')
                            // textthis.parents('td').find('.aUploada').css('width','53px')
                            var siz = 0;
                            textthis.parents('td').find('a').each(function () {
                                if ($(this).hasClass('FtpFileName')) {
                                    siz++;
                                }
                            })
                            var fileNameindex = data.body.fileNames[0].indexOf('-');
                            var truefilename = data.body.fileNames[0].substring(Number(fileNameindex) + 1)
                            if (siz == 0) {
                                textthis.parents('td').find('.uploadfile').before('<a class="FtpFileName" title="' + truefilename + '" data-modeName="' + data.body.modeName + '" data-fileName="' + data.body.fileNames[0] + '" style="margin-right: 10px;">' + truefilename + '</a>');
                            } else {
                                textthis.parents('td').find('.FtpFileName').text(truefilename);
                                textthis.parents('td').find('.FtpFileName').attr('title', truefilename);
                                textthis.parents('td').find('.FtpFileName').attr('data-modeName', data.body.modeName);
                                textthis.parents('td').find('.FtpFileName').attr('data-fileName', data.body.fileNames[0]);
                            }
	                        if(backFunction){
		                        debugger
		                        backFunction();
	                        }
                        }
                    } else if ("0" == data.header.code) {
                        $.MsgBox.alert('系统提示', data.header.msg, function () {
                            window.location.href = "/login.html";
                        });
                    } else {
                        $.MsgBox.alert('系统提示', data.header.msg, function () {
                        });
                    }
                },
                error: function (r, s, e) {
                    var errorval = r.status;
                    if (errorval == 403) {
                        $.MsgBox.alert('系统提示', r.responseJSON.header.msg, function () {
                            window.location.href = "/login.html";
                        });
                    } else {
                        alertNo();
                        $.MsgBox.alert('系统提示', '地址错误或拒绝访问');
                    }
                    return null;
                }
            });
        }
    })
    CommonRequestFtpDownLoad();
};

/*
 * 请求多条ftp文件上传服务
 */
function CommonRequestFtpUploads(modeName) {
    $(document).off("change", ".uploadfile");
    $(document).on("change", ".uploadfile", function () {
        var fileval = $(this).val();
        if (fileval != 0 && fileval) {
            var textthis = $(this);
            var textthis2 = $(this).parents('.dataForm');
            var formData = new FormData(textthis2[0]);
            formData.append("modeName", modeName);
            //上传文件url
            var url = "/ftp/uploadFile";
            // console.log("请求数据==" + formData);
            if (typeof (token) == 'undefined' || token == null || token == '') {
                window.location.href = "/login.html";
            }
            var aJaxRequest = $.ajax({
                type: "POST",
                beforeSend: function (request) {
                    request.setRequestHeader("Authorization", token);
                },
                url: testUrl + url,
                async: true,
                dataType: "json",
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    console.log("响应数据==" + JSON.stringify(data) + 'url==' + url);
                    if ("0" == data.header.code) {
                        if (data.body != null) {
                            var urltextmodename = encodeURI(data.body.modeName);
                            var urltextfilename = encodeURI(data.body.fileNames[0]);
                            textthis.parents('div.fileBox').attr('data-modeName', data.body.modeName);
                            textthis.parents('div.fileBox').find('.littleFileBox').append(`
								<p>
									<span>新建文本文档 .txt（大小：0.63KB）</span>
									<a class="FtpFileName" data-modeName=${data.body.modeName} data-fileName=${data.body.fileNames[0]}>查看</a>
									<a class="FtpDelete">删除</a>
								</p>`
                            )
                            textthis.parents('div.fileBox').find('.littleFileBox p:last-child').attr('data-fileName', data.body.fileNames[0]);
                            textthis.parents('div.fileBox').find('.littleFileBox p:last-child span').html(data.body.fileNames[0].split("-")[1]);
                            var fileNameindex = data.body.fileNames[0].indexOf('-');
                            var truefilename = data.body.fileNames[0].substring(Number(fileNameindex) + 1)
                            textthis.parents('div.fileBox').find('.littleFileBox p:last-child a:eq(1)').attr('title', truefilename);
                        }
                    } else if ("0" == data.header.code) {
                        $.MsgBox.alert('系统提示', data.header.msg, function () {
                            window.location.href = "/login.html";
                        });
                    } else {
                        $.MsgBox.alert('系统提示', data.header.msg, function () { });
                    }
                },
                error: function (r, s, e) {
                    var errorval = r.status;
                    if (errorval == 403) {
                        $.MsgBox.alert('系统提示', r.responseJSON.header.msg, function () {
                            window.location.href = "/login.html";
                        });
                    } else {
                        alertNo();
                        $.MsgBox.alert('系统提示', '地址错误或拒绝访问');
                    }
                    return null;
                }
            });
        }
    })
    $('body').on("click", ".FtpDelete", function () {
        $(this).parents('p').remove();
    })
    CommonRequestFtpDownLoad();
};

/*
 * 文件下载
 */
function CommonRequestFtpDownLoad() {
    $('body').off("click", ".FtpFileName");
    $('body').on("click", ".FtpFileName", function () {
        var ftpthis = $(this);
        var modeName = $(this).attr('data-modeName');
        var fileName = $(this).attr('data-fileName');
        // console.log("请求数据==" + "modeName: "+modeName+"---fileName: "+fileName);
        if (typeof (token) == 'undefined' || token == null || token == '') {
            window.location.href = "/login.html";
        }
        var xhh = new XMLHttpRequest();
        console.log(testUrl + '/ftp/downLoadFile?modeName=' + encodeURIComponent(modeName) + '&fileName=' + encodeURIComponent(fileName))
        xhh.open("GET", testUrl + '/ftp/downLoadFile?modeName=' + encodeURIComponent(modeName) + '&fileName=' + encodeURIComponent(fileName));
        xhh.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xhh.setRequestHeader("Authorization", token);
        xhh.responseType = 'blob';

        xhh.onreadystatechange = function () {
            if (xhh.readyState === 4 && xhh.status === 200) {
                var name = decodeURIComponent(xhh.getResponseHeader("ajax-filename"));
                var mimeType = xhh.getResponseHeader("ajax-mimeType");
                var blob = new Blob([xhh.response], { type: mimeType });
                var csvUrl = URL.createObjectURL(blob);
                var link = document.createElement('a');
                link.href = csvUrl;
                link.download = name;
                link.click();
            }
        };
        xhh.send();
    })
}
// 单选
function clickSingle(item) {
    item.on("click", item, function () {
        $(this).addClass("selected").siblings().removeClass("selected");
    })
}

$("body").delegate("input", "keydown", function (e) {
    var e = e || window.event; // FF、Chrome IE下获取事件对象
    var c = e.charCode || e.keyCode || e.which;//FF、Chrome IE下获取键盘码  =
    if (c == 9) { // 110 (190) - 小(主)键盘上的点
        $('.assoBox').hide();
        $('.assoBox2').hide();
        $('.fkID').addClass('visible');
    }
})

// 下拉列表的事件开始
function tableTheadSearch(func) {

	$(".mainText ").off("click", ".selectElement").on("click", ".selectElement", function (e) {
        e.stopPropagation();
        if ($(this).attr("data-show") == "0") {
            // debugger
            // 移除其他选中的，下拉小时，选中样式删除
            $(this).parent("td").siblings().find(".selectElement").removeClass("selectElement_selected");
            $(this).parent("td").siblings().find(".selectElement_ul").css("display", "none");
            $(this).parent("td").siblings().find(".selectElement").attr("data-show", "0");
            $(this).parent("td").siblings().find(".select_ele_text").css("color", "black");
            $(this).parent("td").siblings().find(".strangle").removeClass("strangle_fan").addClass("strangle_zheng");// 三角标样式
            $(this).parent("td").siblings().find(".strangles").addClass("circle").removeClass("circleWhite")
            $(this).parent("th").siblings().find(".selectElement").removeClass("selectElement_selected");
            $(this).parent("th").siblings().find(".selectElement_ul").css("display", "none");
            $(this).parent("th").siblings().find(".selectElement").attr("data-show", "0");
            $(this).parent("th").siblings().find(".select_ele_text").css("color", "black");
            // 添加该元素选种样式
            $(this).attr("data-show", "1");
            $(this).find(".select_ele_text").css("color", "white");
            $(this).removeClass("selectElement_selected").addClass("selectElement_selected");//添加选中样式
            $(this).find(".selectElement_ul").css("display", "block");//显示下拉
            $(this).find(".strangle").removeClass("strangle_zheng").addClass("strangle_fan");// 三角标样式
            $(this).find(".strangles").addClass("circleWhite").removeClass("circle")
        } else if ($(this).attr("data-show") == "1") {
            $(this).attr("data-show", "0");
            $(this).parent("td").siblings().find(".selectElement").attr("data-show", "0");
            $(this).parent("th").siblings().find(".selectElement").attr("data-show", "0");
            $(this).removeClass("selectElement_selected");
            $(this).find(".select_ele_text").css("color", "black");
            $(".mainText").find(".selectElement_ul ").css("display", "none");
            $(this).find(".strangle").addClass("strangle_zheng").removeClass("strangle_fan")
            $(this).find(".strangles").addClass("circle").removeClass("circleWhite")
        }
        let value = $(this).find(".select_ele_text").attr("data-value");
        let _this = this;
        $(this).find("li").each(function (item, index) {
            if (value == $(this).attr("data-value")) {
                $(this).addClass("clicked").siblings().removeClass("clicked");

            }
        })

    })

    $(document).click(function (e) {
        $(".selectElement").removeClass("selectElement_selected").attr("data-show", "0");
        $(".selectElement").find(".strangle").removeClass("strangle_fan").addClass("strangle_zheng");
        $(".selectElement").find(".strangles").removeClass("circleWhite").addClass("circle");
        $(".selectElement").find(".select_ele_text").css("color", "black");
        $(".selectElement_ul").css("display", "none");
    })
    // $(".defaltTable thead .selectElement").hover(function(){
    //     $(this).css("background-color","#eaf2f9");
    //     $(this).find(".select_ele_text").css("color","#5793cf");
    // },function(){
    //     $(this).css("background-color","#f3f3f3");
    //     $(this).find(".select_ele_text").css("color","black");
    // })
	$(".selectElement_search_input").on('click', function (event) {
		event.stopPropagation();
		if (event.keyCode == "13") {
			$(this).closest(".selectElement_search_div").css("display", "none");
			debugger
			if(ele){
				$(`${ele}`).val("1")
			}else {
				$(`#pageNumber`).val("1")
			}
		}
	});
    tableHeaderSrearch(func)
	// td 的全局双击事件，默认双击后赋值给表头的 input 框，并查询一次
	$(".mainText").off("dblclick", "td[data-dbclickname=]").on("dblclick", "td[data-dbclickname]", function (e) {
		// 在加载的时候要把值先放在  data-dbClickName 属性上,如果是search ，放置的是搜索的字段，如果是下拉查询放置的是 当前值的value
		let dbClickName = $(this).attr("data-dbClickName");
		// 赋值到 thead 的查询中
		let index = $(this).index();
		// 如果是搜索
		let div_selectElement_ul = $(this).closest("table").find(`thead tr td:eq(${index}),thead tr th:eq(${index})`).find("div.selectElement_ul");
		let ul_selectElement_ul = $(this).closest("table").find(`thead tr td:eq(${index}),thead tr th:eq(${index})`).find("ul.selectElement_ul")
		if(div_selectElement_ul && div_selectElement_ul.length>0){
			$(this).closest("table").find(`thead tr td:eq(${index}),thead tr th:eq(${index})`).find(".selectElement_search_input").val(dbClickName);
			if(func){
				func()
			}
			// 如果是搜索
		}else if(ul_selectElement_ul && ul_selectElement_ul.length > 0){
			//console.log($(this).closest("table").find(`thead tr td:eq(${index})`).find(".select_ele_text").html())
			$(this).closest("table").find(`thead tr td:eq(${index}),thead tr th:eq(${index})`).find(".select_ele_text").attr("data-value",dbClickName);
			if(func){
				func()
			}
		}
	})
}

// 封装的表头搜索事件
/*
* pam 需要传递的参数
* func  回调函数，一次性把所有的列表查询项全部都传给后台
* ele  分页当前页值 的id
* */
function tableHeaderSrearch(func,ele){
    // 搜索事件,当点击回车的时候
    $("body").off("keypress",".selectElement_search_input").on('keypress',".selectElement_search_input",function (event) {
        if (event.keyCode == "13") {
            $(this).closest(".selectElement_search_div").css("display", "none");
            if(func){
	            if(ele){
		            $(`${ele}`).val("1")
	            }else {
		            $(`#pageNumber`).val("1")
	            }
	            console.log($(this).val())
                func()
            }
        }
    });
    // 搜索事件,当失去焦点的时候
    $("body").off("blur",".selectElement_search_input").on('blur',".selectElement_search_input",function (event) {
        event.stopPropagation();
        if(func){
	        if(ele){
		        $(`${ele}`).val("1")
	        }else {
		        $(`#pageNumber`).val("1")
	        }
            func()
        }
    });
    $(".selectElement_ul").off("click","li").on("click", "li", function (e) {
        e.stopPropagation();
        $(this).closest(".selectElement").find(".selectElement_ul").css("display", "none");
        $(this).closest(".selectElement").find(".strangle").removeClass("strangle_fan").addClass("strangle_zheng");
        // $(".selectElement").find(".strangles").removeClass("circleWhite").addClass("circle");
        $(this).closest(".selectElement").find(".select_ele_text").attr("data-value", $(this).attr("data-value"));
        console.log( $(this).attr("data-value"))
        if(func){
	        if(ele){
		        $(`${ele}`).val("1")
	        }else {
		        $(`#pageNumber`).val("1")
	        }
	        console.log($(this).val())
            func()
        }
    })

    $(".sortElement").off("click",".sort_icon").on("click",".sort_icon",function(e){
        e.stopPropagation();
        if($(this).attr("data-order") === "0" ){
            $(this).attr("data-order","1");//
            $(this).removeClass("sortIcon_orderBy_default").addClass("sortIcon_orderBy_max")
        }else if($(this).attr("data-order") === "1" ){
            $(this).attr("data-order","2");//
            $(this).removeClass("sortIcon_orderBy_max").addClass("sortIcon_orderBy_min")
        }else if($(this).attr("data-order") === "2" ){
            $(this).attr("data-order","0");//
            $(this).removeClass("sortIcon_orderBy_min").addClass("sortIcon_orderBy_default")
        }
        if(func){
	        if(ele){
		        $(`${ele}`).val("1")
	        }else {
		        $(`#pageNumber`).val("1")
	        }
	        console.log($(this).val())
            func()
        }
    })
}




// 下拉列表的事件结束

function button_selected() {
    $(".mainText").on("click", ".pages  .titleButton li,.pickGoodPlan  .titleButton li", function (e) {
        // e.stopPropagation();
        if ($(this).hasClass("filter") && $(this).attr("data-show") == "0") {
            $(this).attr("data-show", "1");
            $(this).find("p").addClass("titleButton_button_selected");

        } else if ($(this).hasClass("filter") && $(this).attr("data-show") == "1") {
            $(this).attr("data-show", "0");
            $(this).find("p").removeClass("titleButton_button_selected");
        } else {
            $(this).find("p").addClass("titleButton_button_selected");
        }
        $(this).siblings().find("p").removeClass("titleButton_button_selected");

    })
}
// 筛选方法
showSearch();
function showSearch() {
    // 筛选点击的时候展示的是整搜索项
    $(document).on("click", ".filter p", function (e) {
        // debugger
        $(".mainText .searchArea").toggle();
    })
    // .secondSearch 默认不展示，当点击搜索更多的时候展示
    $(document).on("click", "#moreSearch", function () {
        $(".mainText .secondSearch").toggle();
    })
}
// 头部搜索
function clickSearch(searchText) {
    $('.headerSearch').attr({ 'placeholder': searchText, 'title': searchText });
}
// 前后台交互方法
// CommonRequestuniversal 和 CommonRequest 主要是因为requestData不同而封装的不同方法
/**
 * type POST/GET
 * async true异步 false 同步
 * url 地址
 * param 参数
 * sucess 成功执行的回调
 * fail 失败执行的回调
 * global 默认true使用公共事件  false不适用公共事件 如:ajaxStart
 * obj 为扩展参数，当参数不够的时候可以通过键值对的方式进行添加，obj是一个json对象
 * */
function CommonRequestuniversal(type,async,url,param,sucess,fail,global,obj) {
    //测试的时候需要，正式环境删掉
    var repData;
    var reg = /(\:null)+/ig;
    var str =  JSON.stringify(param);
    var requestData;
    if(type == "GET"){
        requestData = param;
    }else{
        requestData = str.replace(reg,"\:\"\"");
    }
    console.log("请求数据 type=="+type);
    console.log("请求数据 requestData=="+requestData);
    console.log("请求url=="+url);
    if(typeof(token)=='undefined'||token==null||token==''){
        window.location.href="/login.html";
    }
    var aJaxRequest = $.ajax({
        type : type,
        beforeSend: function(request) {
            request.setRequestHeader("Authorization", token?token:'');
        },
        url : testUrl + url,
        async : async,
        global:global==null?true:global,
        data : requestData,
        contentType:"application/json",//application/x-www-form-urlencoded//
        dataType : "json",
        success : function(data) {
            console.log("响应数据=="+JSON.stringify(data)+'url=='+url);
            if ("0" == data.header.code) {
                repData=data.body;
                sucess(data.body);
            } else{
                if(fail){
                    fail();//逻辑失败 执行此方法
                }
                $.MsgBox.alert('系统提示',data.header.msg,function(){
                });
            }
        },
        error : function(r, s, e) {
            if(fail){
                fail();//逻辑失败 执行此方法
            }
            alertErrorMsgHide(r,url);
        }
    });
};


// 两个简化参数的ajax
function CommonRequest(type,url, param, sucess, fail) {
    //测试的时候需要，正式环境删掉
    var requestData;
    if(type== "POST"){
        var reg = /(\:null)+/ig;
        var str = JSON.stringify(param);
        requestData = '{' + '"body":' + str + ',' + '"header":' + generateHeader() + '}';
        requestData = requestData.replace(reg, "\:\"\"");
    }else{
        requestData = param
    }

    var aJaxRequest = $.ajax({
        type:type,
        beforeSend: function(request) {
            request.setRequestHeader("Authorization", token?token:'');
        },
        url: testUrl + url,
        async: true,
        global:false,
        data: requestData,
        contentType: "application/json", //application/x-www-form-urlencoded//
        dataType: "json",
        success: function (data) {
            // console.log("响应数据==" + JSON.stringify(data));
            if ("0" == data.header.code) {
                sucess(data.body);
            } else {
                if (typeof(fail) == 'function' && ("1" == data.header.code)) {
                    fail();
                } else {
                    alertNo();
                    $.MsgBox.alert('系统提示', data.header.msg);
                    return null;
                }
            }
        },
        error: function (r, s, e) {
            alertNo();
            var errorval = r.status;
            if (errorval == 403) {
                $.MsgBox.alert('系统提示', r.responseJSON.header.msg + '<br/>错误码:' + errorval + ' <br/>请求路径:<br/>' + url, function () {
                    window.location.href = "/login.html";
                });
            } else if (errorval == 0) {
                $.MsgBox.alert('系统提示', '服务器未响应，请确认路径是否正确！<br/>错误码:' + errorval + ' <br/>请求路径:<br/>' + url, function () {
                });
            } else if (errorval == 404) {
                $.MsgBox.alert('系统提示', 'Web服务器找不到您所请求的文件或脚本！<br/>错误码:' + errorval + ' <br/>请求路径:<br/>' + url, function () {
                });
            } else if (errorval == 500) {
                $.MsgBox.alert('系统提示', 'Web 服务器不能执行此请求！<br/>错误码:' + errorval + ' <br/>请求路径:<br/>' + url, function () {
                });
            } else {
                $.MsgBox.alert('系统提示', '地址错误或拒绝访问!<br/>错误码:' + errorval + ' <br/>请求路径:<br/>' + url);
            }
            return null;
        }
    });
    //          return null;
};


/**
 * 通用错误弹窗 自动隐藏
 * @param errorval 错误码
 */
function alertErrorMsgHide(r,url){
    var errorval = r.status;
    if(errorval==403){
        $.MsgBox.alert('系统提示',r.responseJSON.header.msg+'<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){
            window.location.href="/login.html";
        });
    }else if(errorval==0){
        $.MsgBox.alert('系统提示','服务器未响应，请确认路径是否正确！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==400){
        $.MsgBox.alert('系统提示','由于语法格式有误，服务器无法理解此请求！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==401.1){
        $.MsgBox.alert('系统提示','传输给服务器的证书与登录服务器所需的证书不匹配！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==401.2){
        $.MsgBox.alert('系统提示','传输给服务器的证书与登录服务器所需的证书不匹配！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==401.3){
        $.MsgBox.alert('系统提示','传输的证书没有对服务器中特定资源的访问权限！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==401.4){
        $.MsgBox.alert('系统提示','筛选程序拒绝连接到此服务器的真品证书的访问！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==401.5){
        $.MsgBox.alert('系统提示','Web服务器中的地址已经安装了 ISAPI 或 CGI程序,此程序拒绝用来连接到服务器的真品证书的访问！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.1){
        $.MsgBox.alert('系统提示','从并不允许执行程序的目录中执行 CGI、ISAPI或其他执行程序就可能引起此错误！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.2){
        $.MsgBox.alert('系统提示','没有可用的默认网页或未启用此目录的目录浏览或者试图显示驻留在只标记为执行或脚本权限的目录中的HTML 页！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.3){
        $.MsgBox.alert('系统提示','试图上载或修改不允许写访问的目录中的文件！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.4){
        $.MsgBox.alert('系统提示','试图访问的网页受安全套接字层（SSL）的保护！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.5){
        $.MsgBox.alert('系统提示','您试图访问的资源受 128位的安全套接字层（SSL）保护。要查看此资源，需要有支持此SSL层的浏览器！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.6){
        $.MsgBox.alert('系统提示','服务器含有不允许访问此站点的 IP地址列表，并且您正使用的 IP地址在此列表中！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.7){
        $.MsgBox.alert('系统提示','访问的资源要求浏览器具有服务器可识别的用户安全套接字层（SSL）证书！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.8){
        $.MsgBox.alert('系统提示','Web服务器不为请求提供服务或您没有连接到此站点的权限！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.9){
        $.MsgBox.alert('系统提示','Web太忙并且由于流量过大而无法处理您的请求！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.10){
        $.MsgBox.alert('系统提示','Web 服务器的配置存在问题！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.11){
        $.MsgBox.alert('系统提示','身份验证的过程中如果用户输入错误的密码！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.12){
        $.MsgBox.alert('系统提示','拒绝用户证书试图访问此 Web 站点！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.13){
        $.MsgBox.alert('系统提示','客户证书被取消！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.14){
        $.MsgBox.alert('系统提示','目录列表被拒绝！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.15){
        $.MsgBox.alert('系统提示','超出客户访问许可证！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.16){
        $.MsgBox.alert('系统提示','客户证书不受信任或无效！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==403.17){
        $.MsgBox.alert('系统提示','客户证书已过期或无效！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==404){
        $.MsgBox.alert('系统提示','Web服务器找不到您所请求的文件或脚本！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==404.1){
        $.MsgBox.alert('系统提示','站点没有找到！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==405){
        $.MsgBox.alert('系统提示','请求所标识的资源，不允许使用请求行中所指定的方法！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==406){
        $.MsgBox.alert('系统提示','根据此请求中所发送的“接受”标题，此请求所标识的资源只能生成内容特征为“不可接受”的响应实体！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==407){
        $.MsgBox.alert('系统提示','在可为此请求提供服务之前，您必须验证此代理服务器。请登录到代理服务器，然后重试！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==412){
        $.MsgBox.alert('系统提示','在服务器上测试前提条件时，部分请求标题字段中所给定的前提条件估计为FALSE！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==414){
        $.MsgBox.alert('系统提示','Request-URL太长，服务器拒绝服务此请求！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==500){
        $.MsgBox.alert('系统提示','Web 服务器不能执行此请求！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==500.12){
        $.MsgBox.alert('系统提示','应用程序重新启动！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==500.13){
        $.MsgBox.alert('系统提示','服务器太忙！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==500.15){
        $.MsgBox.alert('系统提示','不允许请求 Global.asa！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==501){
        $.MsgBox.alert('系统提示','Web 服务器不支持实现此请求所需的功能！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else if(errorval==502){
        $.MsgBox.alert('系统提示','当用作网关或代理时，服务器将从试图实现此请求时所访问的upstream 服务器中接收无效的响应！<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url,function(){});
    }else{
        $.MsgBox.alert('系统提示','地址错误或拒绝访问!<br/>错误码:'+errorval+' <br/>请求路径:<br/>'+url);
    }
}


// 模态框开始
function openModal(target) {
    var obj = $(".main").find(target);
    var veil = obj.prev();
    veil.css({ visibility: 'visible', opacity: 0.3 });
    obj.css("display", "block");
    obj.on("click", ".closeModal", function () {
        veil.css({ visibility: 'hidden', opacity: 0 });
        obj.css("display", "none");
        $(".modal .checkAll").removeClass("selected")
    })
    // $(target).find('.modalHead').append('<i class="otherimgx closeModal"></i>')
}
function closeModal(target) {
    var obj = $(target);
    var veil = obj.prev();
    veil.css({ visibility: 'hidden', opacity: 0 });
    obj.css("display", "none");
    obj.find('.otherimgx').remove();
}

function suitSize(jqObj) {
    var width = jqObj.outerWidth(),
        height = jqObj.outerHeight();
    /*获取浏览器长宽*/
    var windowH = document.documentElement.clientHeight,
        windowW = document.documentElement.clientWidth;
    jqObj.css({ 'top': Math.abs((windowH - height) / 2) + 'px', 'left': Math.abs((windowW - width) / 2) + 'px' });
}

/*模态弹出层*/
function addModal() {
    $.each($('.modal'), function(){
        if(!$(this).prev().hasClass("veil")){
            $(this).before('<div class="veil"></div>');
        }
    })
    suitSize($(".modal"));
    $(".modal").each(function () {
        suitSize($(this));
    })
}
// 模态框结束



/*数值转换成html样式
* amount  数字
* currency 币种类型
*/
function tranAmount(amount, currency) {
    amount = moneys(amount);
    amount = amount + "";
    if (amount) {
        var index1 = amount.indexOf("."),
            integer,
            decimal,
            integer2 = "",
            decimal2 = "";
        if (index1 > 0) {
            integer = amount.substring(0, index1);
            decimal = amount.substring(index1 + 1, amount.length);
        } else {
            integer = amount;
        }
        for (var i = 0; ; i++) {
            integer2 = "," + integer.substring(integer.length - (i + 1) * 3, integer.length - i * 3) + integer2;
            if (amount.length - (i + 1) * 3 < 1) break;
        }
        integer2 = integer2.substring(1, integer2.length);
        if (integer2.charAt(0) == ",") {
            integer2 = integer2.substring(1, integer2.length);
        }
        if (decimal) {
            if (decimal.length == 1) decimal2 = decimal + "0";
            if (decimal.length == 2) decimal2 = decimal + "";
        } else {
            decimal2 = "00";
        }
        return (currency ? currency : '¥') + '&nbsp;' + integer2 + '.' + decimal2;
    }
}
//四舍五入
function moneys(floatvar) {
    var f_x = parseFloat(floatvar);
    if (isNaN(f_x)) {
        return '0.00';
    }
    var f_x = Math.round(f_x * 100) / 100;
    var s_x = f_x.toString();
    var pos_decimal = s_x.indexOf('.');
    if (pos_decimal < 0) {
        pos_decimal = s_x.length;
        s_x += '.';
    }
    while (s_x.length <= pos_decimal + 2) {
        s_x += '0';
    }
    return s_x;
}
//input输入框填充值
function inputData(str, sign) {
    var newStr = "";
    var count = 0;
    str = str.toString();
    if (str.indexOf(".") == -1) {
        for (var i = str.length - 1; i >= 0; i--) {
            if (count % 3 == 0 && count != 0) {
                newStr = str.charAt(i) + "," + newStr;
            } else {
                newStr = str.charAt(i) + newStr;
            }
            count++;
        }
        str = newStr + ".00"; //自动补小数点后两位
    } else {
        for (var i = str.indexOf(".") - 1; i >= 0; i--) {
            if (count % 3 == 0 && count != 0) {
                newStr = str.charAt(i) + "," + newStr; //碰到3的倍数则加上“,”号
            } else {
                newStr = str.charAt(i) + newStr; //逐个字符相接起来
            }
            count++;
        }
        str = newStr + (str + "00").substr((str + "00").indexOf("."), 3);
    }
    return (sign ? sign + " " + str : "¥ " + str);
}

//币种转换
function swtCur(code) {
    var x = '￥', y = '人民币';
    switch (code) {
        case 'CNY': x = "¥"; y = "人民币"; break;
        case 'USD': x = "$"; y = "美元"; break;
        case 'AFN': x = "AFN"; y = "阿富汗尼"; break;
        case 'AED': x = "د.إ"; y = "迪拉姆"; break;
        case 'OMR': x = "ر.ع."; y = "里亚尔"; break;
        case 'AZN': x = "m"; y = "马纳特"; break;
        case 'PKR': x = "₨"; y = "卢比"; break;
        case 'BHD': x = "ب.د"; y = "第纳尔"; break;
        case 'BTN': x = "BTN"; y = "努尔特鲁姆"; break;
        case 'INR': x = "₨"; y = "印度卢比"; break;
        case 'KPW': x = "₩"; y = "朝鲜元"; break;
        case 'USD': x = "$"; y = "美元"; break;
        case 'PHP': x = "₱"; y = "菲律宾比索"; break;
        case 'GEL': x = "ლ"; y = "拉里"; break;
        case 'KZT': x = "Т"; y = "坚戈"; break;
        case 'KRW': x = "₩"; y = "韩元"; break;
        case 'KHR': x = "៛"; y = "瑞尔"; break;
        case 'KGS': x = "KGS"; y = "索姆"; break;
        case 'QAR': x = "ر.ق"; y = "里亚尔"; break;
        case 'KWD': x = "د.ك"; y = "第纳尔"; break;
        case 'LAK': x = "₭"; y = "基普"; break;
        case 'LBP': x = "ل.ل"; y = "黎巴嫩镑"; break;
        case 'MVR': x = "ރ."; y = "拉菲亚"; break;
        case 'MYR': x = "RM"; y = "令吉"; break;
        case 'BDT': x = "৳"; y = "塔卡"; break;
        case 'MNT': x = "₮"; y = "图格里克"; break;
        case 'MMK': x = "K"; y = "缅元"; break;
        case 'NPR': x = "₨"; y = "卢比"; break;
        case 'JPY': x = "¥"; y = "日元"; break;
        case 'SAR': x = "ر.س"; y = "沙特里亚尔"; break;
        case 'LKR': x = "ரூ"; y = "卢比"; break;
        case 'TJS': x = "ЅМ"; y = "索莫尼"; break;
        case 'THB': x = "฿"; y = "泰铢"; break;
        case 'TMM': x = "m"; y = "马纳特"; break;
        case 'UZS': x = "UZS"; y = "索姆"; break;
        case 'BND': x = "$"; y = "文莱元"; break;
        case 'SGD': x = "$"; y = "新加坡元"; break;
        case 'SYP': x = "£"; y = "叙利亚镑"; break;
        case 'AMD': x = "դր."; y = "德拉姆"; break;
        case 'YER': x = "﷼"; y = "里亚尔"; break;
        case 'IQD': x = "ع.د"; y = "第纳尔"; break;
        case 'IRR': x = "﷼"; y = "里亚尔"; break;
        case 'ILS': x = "₪"; y = "新谢克尔"; break;
        case 'INR': x = "₨"; y = "卢比"; break;
        case 'IDR': x = "₨"; y = "印尼盾"; break;
        case 'JOD': x = "د.ا"; y = "第纳尔"; break;
        case 'VND': x = "₫"; y = "越南盾"; break;
        case 'TRY': x = "₤"; y = "新里拉"; break;
        case 'TWD': x = "$"; y = "新台币"; break;
        case 'ILS': x = "₪"; y = "新谢克尔"; break;
        case 'TRY': x = "₤"; y = "新土耳其里拉"; break;
        case 'GEL': x = "ლ"; y = "格鲁吉亚拉里"; break;
        case 'RUB': x = "₽"; y = "俄罗斯卢布"; break;
        case 'AMD': x = "դր."; y = "亚美尼亚德拉姆"; break;
        case 'GEL': x = "ლ"; y = "格鲁吉亚拉里"; break;
        case 'RUB': x = "₽"; y = "俄罗斯卢布"; break;
        case 'HKD': x = "$"; y = "港元"; break;
        case 'MOP': x = "P"; y = "澳门元"; break;
        case 'GBP': x = "£"; y = "英镑"; break;
        case 'ALL': x = "L"; y = "列克"; break;
        case 'BYN': x = "Br"; y = "卢布"; break;
        case 'ISK': x = "kr"; y = "克朗"; break;
        case 'BAM': x = "KM"; y = "波斯尼亚和黑塞哥维那可兑换马克"; break;
        case 'BGN': x = "лв"; y = "列弗"; break;
        case 'PLN': x = "zł"; y = "兹罗提"; break;
        case 'DKK': x = "kr"; y = "克朗"; break;
        case 'RUB': x = "₽"; y = "卢布"; break;
        case 'EUR': x = "€"; y = "欧元"; break;
        case 'CZK': x = "Kč"; y = "克朗"; break;
        case 'HRK': x = "kn"; y = "库纳"; break;
        case 'CHF': x = "Fr"; y = "瑞士法郎"; break;
        case 'LTL': x = "Lt"; y = "立特"; break;
        case 'RON': x = "RON"; y = "新列伊"; break;
        case 'ROL': x = "ROL"; y = "旧列伊"; break;
        case 'MKD': x = "ден"; y = "德纳尔"; break;
        case 'MTL': x = "₤"; y = "里拉"; break;
        case 'MDL': x = "L"; y = "列伊"; break;
        case 'NOK': x = "kr"; y = "克朗"; break;
        case 'SEK': x = "kr"; y = "克朗"; break;
        case 'CHF': x = "Fr"; y = "法郎"; break;
        case 'CSD': x = "Din."; y = "第纳尔"; break;
        case 'SKK': x = "Sk"; y = "克朗"; break;
        case 'UAH': x = "₴"; y = "格里夫纳"; break;
        case 'HUF': x = "Ft"; y = "福林"; break;
        case 'GBP': x = "£"; y = "英镑"; break;
        case 'CSD': x = "Din."; y = "塞尔维亚第纳尔"; break;
        case 'RUB': x = "₽"; y = "卢布"; break;
        case 'PRB': x = "р."; y = "德涅斯特河沿岸卢布"; break;
        case 'GIP': x = "£"; y = "直布罗陀镑"; break;
        case 'DKK': x = "kr"; y = "丹麦克朗"; break;
        case 'LVL': x = "€"; y = "欧元"; break;
        case 'DZD': x = "د.ج"; y = "第纳尔"; break;
        case 'EGP': x = "£"; y = "埃及镑"; break;
        case 'ETB': x = "ETB"; y = "比尔"; break;
        case 'AOA': x = "Kz"; y = "宽扎"; break;
        case 'BWP': x = "P"; y = "普拉"; break;
        case 'BIF': x = "Fr"; y = "法郎"; break;
        case 'ERN': x = "ERN"; y = "纳克法"; break;
        case 'CVE': x = "$"; y = "埃斯库多"; break;
        case 'GMD': x = "D"; y = "达拉西"; break;
        case 'CDF': x = "Fr"; y = "法郎"; break;
        case 'GHC': x = "₵"; y = "加纳塞地"; break;
        case 'ZWD': x = "$"; y = "津巴布韦元"; break;
        case 'DJF': x = "Fr"; y = "法郎"; break;
        case 'GNF': x = "Fr"; y = "法郎"; break;
        case 'KMF': x = "Fr"; y = "法郎"; break;
        case 'KES': x = "Sh"; y = "先令"; break;
        case 'LSL': x = "L"; y = "马洛蒂"; break;
        case 'ZAR': x = "R"; y = "南非兰特"; break;
        case 'LRD': x = "$"; y = "利比里亚元"; break;
        case 'LYD': x = "ل.د"; y = "第纳尔"; break;
        case 'RWF': x = "Fr"; y = "法郎"; break;
        case 'MGA': x = "MGA"; y = "阿里亚里"; break;
        case 'MWK': x = "MK"; y = "克瓦查"; break;
        case 'MRO': x = "UM"; y = "乌吉亚"; break;
        case 'MUR': x = "₨"; y = "卢比"; break;
        case 'MAD': x = "د.م."; y = "迪拉姆"; break;
        case 'MZN': x = "MTn"; y = "新梅蒂卡尔"; break;
        case 'NAD': x = "$"; y = "纳米比亚元"; break;
        case 'ZAR': x = "R"; y = "南非兰特"; break;
        case 'SSP': x = "£"; y = "南苏丹镑"; break;
        case 'NGN': x = "₦"; y = "奈拉"; break;
        case 'STD': x = "Db"; y = "多布拉"; break;
        case 'SCR': x = "₨"; y = "卢比"; break;
        case 'SLL': x = "Le"; y = "利昂"; break;
        case 'SOS': x = "Sh"; y = "先令"; break;
        case 'SDD': x = "SDD"; y = "苏丹镑"; break;
        case 'SZL': x = "L"; y = "斯威士兰里兰吉尼"; break;
        case 'TZS': x = "Sh"; y = "先令"; break;
        case 'TND': x = "د.ت"; y = "第纳尔"; break;
        case 'UGX': x = "Sh"; y = "先令"; break;
        case 'ZMK': x = "ZK"; y = "克瓦查"; break;
        case 'XOF': x = "Fr"; y = "非洲金融共同体法郎"; break;
        case 'XAF': x = "Fr"; y = "中非法郎"; break;
        case 'MAD': x = "د.م."; y = "摩洛哥迪拉姆"; break;
        case 'SHP': x = "£"; y = "圣赫伦那镑"; break;
        case 'GBP': x = "£"; y = "英镑"; break;
        case 'BSD': x = "$"; y = "巴哈马元"; break;
        case 'BBD': x = "$"; y = "巴巴多斯元"; break;
        case 'BZD': x = "$"; y = "伯利兹元"; break;
        case 'PAB': x = "B/."; y = "巴拿马巴波亚"; break;
        case 'DOP': x = "$"; y = "多米尼加比索"; break;
        case 'CRC': x = "₡"; y = "科朗"; break;
        case 'CUC': x = "$"; y = "古巴可兑换比索"; break;
        case 'CUP': x = "$"; y = "古巴比索"; break;
        case 'HTG': x = "G"; y = "海地古德"; break;
        case 'HNL': x = "L"; y = "伦皮拉"; break;
        case 'CAD': x = "$"; y = "加拿大元"; break;
        case 'SVC': x = "₡"; y = "克朗"; break;
        case 'MXN': x = "$"; y = "墨西哥比索"; break;
        case 'NIO': x = "C$"; y = "尼加拉瓜科多巴"; break;
        case 'TTD': x = "$"; y = "特立尼达和多巴哥元"; break;
        case 'GTQ': x = "Q"; y = "格查尔"; break;
        case 'JMD': x = "$"; y = "牙买加元"; break;
        case 'XCD': x = "$"; y = "东加勒比元"; break;
        case 'KYD': x = "$"; y = "开曼群岛元"; break;
        case 'BMD': x = "$"; y = "百慕大元"; break;
        case 'AWG': x = "ƒ"; y = "阿鲁巴弗罗林"; break;
        case 'ARS': x = "$"; y = "阿根廷比索"; break;
        case 'BOB': x = "Bs."; y = "玻利维亚诺"; break;
        case 'BRL': x = "R$"; y = "巴西雷亚尔"; break;
        case 'PYG': x = "₲"; y = "瓜拉尼"; break;
        case 'PEN': x = "S/."; y = "索尔"; break;
        case 'COP': x = "$"; y = "哥伦比亚比索"; break;
        case 'GYD': x = "$"; y = "圭亚那元"; break;
        case 'SRD': x = "$"; y = "苏里南元"; break;
        case 'VEB': x = "Bs"; y = "强势玻利瓦尔"; break;
        case 'UYU': x = "$"; y = ""; break;
        case 'CLP': x = "$"; y = "智利比索"; break;
        case 'FKP': x = "£"; y = "福克兰群岛镑"; break;
        case 'ANG': x = "ƒ"; y = "荷属安的列斯盾"; break;
        case 'AUD': x = "$"; y = "澳元"; break;
        case 'PGK': x = "K"; y = "巴布亚新几内亚基那"; break;
        case 'FJD': x = "$"; y = "斐济元"; break;
        case 'WST': x = "T"; y = "塔拉"; break;
        case 'SBD': x = "$"; y = "所罗门群岛元"; break;
        case 'TOP': x = "T$"; y = "潘加"; break;
        case 'VUV': x = "Vt"; y = "瓦图"; break;
        case 'NZD': x = "$"; y = "新西兰元"; break;
        case 'XPF': x = "Fr"; y = "太平洋法郎"; break;
        case 'NZD': x = "$"; y = "新西兰元"; break;
        case 'GBP': x = "£"; y = "南乔治亚和南桑德韦奇群岛镑"; break;
    }
    return { 'sign': x, 'Chinese': y };
}


/**
 * 获取url参数
 * @param name url取值
 */

function getParamterStringCom(name) {
    var tUrl  = sessionStorage.getItem("url");
    tUrl = tUrl.replace("?","&");
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = tUrl.match(reg);
    console.log(r)
    if (r != null)
        return (r[2]);
    return null;
}

/**多选框公共绑定
 * .checkAll 表示多选框
 * attr属性：isCheckAllGroup true/false 表示多选框分组启用
 * attr属性：checkAllGroup ='??' 表示多选框分组名称   ??自定义名称
 * attr属性：isCheckSingle true/false 表示多选框单选启用
 * checkSingleName：checkSingleName='??' 单选分组标识-分组名称 ??自定义名称
*/
$(document).on("click", ".checkAll", function () {
    let checkBoxEl = $(this);
    let isSelected = checkBoxEl.hasClass("selected") ;//是否被选中

    if(isSelected){//原来是否被选中 是
        //设置为 未被选中
        checkBoxEl.removeClass("selected");
        checkBoxEl.attr("data-value", "0");
    }else {// 原来是否被选中 是
        //设置为 被选中
        checkBoxEl.addClass("selected");
        checkBoxEl.attr("data-value", "1");
    }
    let isCheckAllGroup = checkBoxEl.attr('isCheckAllGroup');//是否多选分组（是：联动同样分组名称的多选框  否：不联动）
    if(isCheckAllGroup){//是全选按钮
        let checkAllGroup = checkBoxEl.attr('checkAllGroup');//多选分组名
        if(checkAllGroup){
            $('.checkAll[checkAllGroup='+checkAllGroup+']').each(function (index, item) {
                if(isSelected){//原来是否被选中 是
                    //设置为 未被选中
                    $(item).removeClass("selected");
                    $(item).attr("data-value", "0");
                }else {////原来是否被选中 是
                    //设置为 被选中
                    $(item).addClass("selected");
                    $(item).attr("data-value", "1");
                }
            })
        }
    }else{//非全选按钮
        let checkAllGroup = checkBoxEl.attr('checkAllGroup');//多选分组名
        if(checkAllGroup){
            $('.checkAll[checkAllGroup='+checkAllGroup+']').each(function (index, item) {
                if(isSelected){//原来是否被选中 是
                    //设置对应的全选按钮为 未被选中
                    let isCheckAllGroup = $(item).attr('isCheckAllGroup');//是否多选按钮
                    if(isCheckAllGroup){
                        $(item).removeClass("selected");
                        $(item).attr("data-value", "0");
                    }
                }
            })
        }

    }
    // 根据属性判断当前的是不是单选，如果是，那么所有的有相同名字的不能多选，
    let isCheckSingle = checkBoxEl.attr('isCheckSingle');//是否单选分组（是：联动同样分组名称的多选框  否：不联动）
    if(isCheckSingle && (isCheckSingle==true||isCheckSingle=='true') ){
        let checkSingleName = checkBoxEl.attr('checkSingleName');//单选分组名
        if(checkSingleName){
            if(!isSelected){
                $('.checkAll[checkSingleName='+checkSingleName+']').not(this).removeClass("selected");
                $('.checkAll[checkSingleName='+checkSingleName+']').not(this).attr("data-value", "0");
            }else {}
        }
    }
})